set more off
clear all

cap log close
log using $DIR\mg_all,t replace

use $IPDIR\enia_ip, clear
rename id_region region_enia

rename year ano
merge 1:1 id ano using $INNODIR\innovacion_ip
rename id_nestab nestab_ip

gen innosmpl = _m>1
drop _m
rename ano year

* remove uninformative ID prefix
rename id_* *

*** Combine region info
replace region_enia = region if region_enia==. & region==13
replace region_enia = 16 if region_enia==. & region~=13 & region~=.
label var region "Region from innovacion survey - 1/16"
label var region_enia "Region from ENIA - 13 and 16"

tab year innosmpl
do $DIR\cleanfile
sum
save $DIR\enia_inno_ip,replace

log close



